using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class TruckMap : EntityTypeConfiguration<Truck>
	{
		public TruckMap()
		{
			// Primary Key
			this.HasKey(t => t.TruckID);

			// Properties
			this.Property(t => t.TruckNo)
				.HasMaxLength(20);
				
			this.Property(t => t.GpsID)
				.HasMaxLength(50);
				
			this.Property(t => t.ProvinceID)
				.HasMaxLength(20);
				
			this.Property(t => t.CityID)
				.HasMaxLength(20);
				
			// Table & Column Mappings
			this.ToTable("Truck");
			this.Property(t => t.TruckID).HasColumnName("TruckID");
			this.Property(t => t.TruckNo).HasColumnName("TruckNo");
			this.Property(t => t.GpsID).HasColumnName("GpsID");
			this.Property(t => t.ProvinceID).HasColumnName("ProvinceID");
			this.Property(t => t.CityID).HasColumnName("CityID");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.CreateBy).HasColumnName("CreateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
		}
	}
}

